home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 501-525 / disk_511 / less / less.doc < prev    next >
Text File  |  1992-05-06  |  21KB  |  503 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. _l_e_s_s - _o_p_p_o_s_i_t_e _o_f _m_o_r_e
  8.  
  9. Version 1.4Z June 14, 1991
  10.  
  11. Versions since Amiga version 1.3Z are supported by
  12.  
  13. Raymond L. Zarling,
  14. Department of Computer Science
  15. Calif. State Univ. Stanislaus
  16. Turlock, CA 95380
  17.  
  18. rayz@csustan.EDU
  19.  
  20.  
  21. _l_e_s_s [-_d_s_t_w_c_C_e_E_m_M_q_Q_u_U] [-_h_N] [-b[fp]_N] [-x_N] [-[z]_N]
  22.      [-_P[_m_M]_s_t_r_i_n_g] [+_c_m_d]  [_f_i_l_e_n_a_m_e]...
  23.  
  24. _L_e_s_s is a program similar to  _m_o_r_e  (1),  but  which  allows
  25. backwards  movement in the file as well as forward movement.
  26. Also, _l_e_s_s does not have  to  read  the  entire  input  file
  27. before starting, so with large input files it starts up fas-
  28. ter than most text editors.
  29.  
  30.      Commands are based on _m_o_r_e,  _v_i and _e_m_a_c_s.   Commands  may
  31. be  preceeded  by a decimal number, called N in the descrip-
  32. tions below.  The number is used by some commands, as  indi-
  33. cated.
  34.  
  35.  
  36. _I_n _t_h_e _f_o_l_l_o_w_i_n_g _d_e_s_c_r_i_p_t_i_o_n_s, ^_X _m_e_a_n_s _c_o_n_t_r_o_l-_X.
  37.  
  38. H or Help key
  39.      Help: display a summary of these commands.  If you for-
  40.      get all the other commands, remember this one.
  41.  
  42.  
  43. SPACE
  44.      Scroll forward N lines, default one window (see  option
  45.      -z below).  If N is more than the screen size, only the
  46.      final screenful is displayed.
  47.  
  48.  
  49. f or ^F
  50.      Same as SPACE.
  51.  
  52.  
  53. ^V
  54.      Same as SPACE.
  55.  
  56.  
  57. b or ^B
  58.      Scroll backward N lines, default one window (see option
  59.      -z below).  If N is more than the screen size, only the
  60.      final screenful is displayed.
  61.  
  62.  
  63. RETURN
  64.      Scroll forward N lines, default 1.  The entire N lines
  65.      are displayed, even if N is more than the screen size.
  66.  
  67.  
  68. e or ^E
  69.      Same as RETURN.
  70.  
  71. ^N
  72.      Same as RETURN.
  73.  
  74.  
  75. j or ^J
  76.      Also the same as RETURN.
  77.  
  78. y or ^Y
  79.      Scroll backward N lines, default 1.  The entire N lines
  80.      are displayed, even if N is more than the screen size.
  81.  
  82. k or ^K
  83.      Same as y.
  84.  
  85. ^P
  86.      Same as y.
  87.  
  88.  
  89. d or ^D
  90.      Scroll forward N lines, default half of the screen.  If
  91.      N is specified, it becomes the new default for subsequent
  92.      d and u commands.  The half-screen default is set again
  93.      whenever the screen is resized.
  94.  
  95.  
  96. u or ^U
  97.      Scroll backward N lines, default half of the screen.  If
  98.      N is specified, it becomes the new default for subsequent
  99.      d and u commands.  The half-screen default is set again
  100.      whenever the screen is resized.
  101.  
  102.  
  103. r or ^R or ^L
  104.      Repaint the screen.
  105.  
  106.  
  107. R    Repaint the  screen,  discarding  any  buffered  input.
  108.      Useful  if  the  file  is  changing  while  it is being
  109.      viewed.
  110.  
  111.  
  112. g    Go to line N in  the  file,  default  1  (beginning  of
  113.      file).  (Warning: this may be slow if N is large.)
  114.  
  115. <    Same as g.
  116.  
  117.  
  118. G    Go to line N in the file, default the end of the  file.
  119.      (Warning:  this  may  be slow if standard input, rather
  120.      than a file, is being read.)
  121.  
  122. >    Same as G.
  123.  
  124.  
  125. p    Go to a position N percent into the file.  N should  be
  126.      between 0 and 100.  (This is possible if standard input
  127.      is being read, but only if _l_e_s_s has already read to the
  128.      end  of  the  file.   It is always fast, but not always
  129.      useful.)
  130.  
  131.  
  132. %    Same as p.
  133.  
  134.  
  135. m    Followed by any lowercase  letter,  marks  the  current
  136.      position with that letter.
  137.  
  138.  
  139. '    (Single  quote.)  Followed  by  any  lowercase  letter,
  140.      returns  to  the  position  which was previously marked
  141.      with that letter.  Followed by  another  single  quote,
  142.      returns  to the postion at which the last "large" move-
  143.      ment command was executed.  All marks are lost  when  a
  144.      new file is examined.
  145.  
  146.  
  147. /pattern
  148.      Search forward in the file for the N-th line containing
  149.      the  pattern.  N defaults to 1.  The pattern is a regu-
  150.      lar expression, as recognized by Unix _e_d (see the
  151.      section on regular expressions below).  The search starts
  152.      at  the  second  line displayed (but see the -t option,
  153.      which changes this).  If the pattern is omitted, search
  154.      for another occurance of the most recent pattern.
  155.  
  156. ^S   Same as /.
  157.  
  158.  
  159. ?pattern
  160.      Search backward in the file for the N-th line  contain-
  161.      ing the pattern.  The search starts at the line immedi-
  162.      ately before the top line displayed.  If the pattern is
  163.      omitted, search for another occurance of the most recent
  164.      pattern.
  165.  
  166.  
  167. n    Repeat previous search, for N-th  line  containing  the
  168.      last pattern, searching in the same direction as the
  169.      previous search.
  170.  
  171.  
  172. E    Examine a new file.  If the filename  is  missing,  the
  173.      "current"  file  (see  the N and P commands below) from
  174.      the list of files in the command line  is  re-examined.
  175.      If  the  filename  is  a pound sign (#), the previously
  176.      examined file is re-examined (one level of backup only).
  177.  
  178.  
  179. N    Examine the next file (from the list of files given  in
  180.      the  command line).  If a number N is specified (not to
  181.      be confused with the command N), the N-th next file  is
  182.      examined.
  183.  
  184.  
  185. P    Examine the previous file.  If a number N is specified,
  186.      the N-th previous file is examined.
  187.  
  188.  
  189. = or ^G
  190.      Prints some information about the  file  being  viewed,
  191.      including  its  name  and the byte offset of the bottom
  192.      line being displayed.  If possible, it also prints  the
  193.      length  of  the  file and the percent of the file above
  194.      the last displayed line.
  195.  
  196.  
  197. -    Followed by one of the command line option letters (see
  198.      below), this will toggle the setting of that option
  199.      and/or print a message describing the new setting.  Not
  200.      all options can be set from within the program:  b, P,
  201.      and window sizing are command-line only options.
  202.  
  203. +cmd Causes the specified cmd to be executed each time a new
  204.      file  is examined.  For example, +G causes _l_e_s_s to ini-
  205.      tially display each file starting  at  the  end  rather
  206.      than the beginning.
  207.  
  208.  
  209. V    Prints the version number of _l_e_s_s being run.
  210.  
  211.  
  212. q    Exits _l_e_s_s.
  213.  
  214.  
  215. _C_o_m_m_a_n_d _l_i_n_e _o_p_t_i_o_n_s _a_r_e _d_e_s_c_r_i_b_e_d _b_e_l_o_w.  _M_o_s_t _o_p_t_i_o_n_s  _m_a_y
  216. _b_e _c_h_a_n_g_e_d _w_h_i_l_e _l_e_s_s is running, via the "-" command.
  217.  
  218.      Options are also taken from  the  environment  variable
  219. "LESS".   For  example, if you like very verbose prompting, to
  220. avoid typing "less -M ..." each time _l_e_s_s  is  invoked,  you
  221. might tell _c_s_h or the AmigaDOS shell:
  222.  
  223. setenv LESS M
  224.  
  225. or if you use _S_K_s_h:
  226.  
  227. LESS=M; export LESS
  228.  
  229. The environment variable is parsed before the command  line,
  230. so  command line options override the LESS environment vari-
  231. able.  A dollar sign ($) may be used to signal the end of an
  232. option  string.   This is important only for options like -P
  233. which take a following string.
  234.  
  235. Some options have values, some are 2-way toggles, and some are
  236. 3-way toggles.  The 3-way ones are handled by using both an
  237. upper-case and a lower-case option name.  Usually, the upper-
  238. case option is the most extreme, the lower-case setting is
  239. moderate, and neither is least extreme.  For instance, the
  240. -m and -M options control the length of the prompt line.  If
  241. -M is in effect, you get a relatively long prompt, while -m
  242. is much shorter.  If neither -m nor -M is set, the prompt is
  243. a single ":" character (unless you redefine one or more of
  244. these using -P).  To change a 3-way option, use either -x or
  245. -X, where x is the option name.  Typing -x will establish the
  246. moderate case if it wasn't already set (i.e. either -X or
  247. neither was in effect) or set the least extreme ("neither")
  248. choice if it was.  Similarly, -X would establish the X option
  249. if it wasn't already in effect; otherwise "neither".
  250.  
  251. -b   Numeric; set from command line or environment only.
  252.      The -b_n option tells _l_e_s_s to use a non-standard  buffer
  253.      size.   There  are two standard (default) buffer sizes,
  254.      one is used when a file is being  read  and  the  other
  255.      when  a  pipe  (standard  input)  is  being  read.  The
  256.      current defaults are 5 buffers for  files  and  12  for
  257.      pipes.   (Buffers  are 1024 bytes.) The number _n speci-
  258.      fies a different number of buffers to use.  The -b  may
  259.      be followed by "f", in which case only the file default
  260.      is changed, or by "p"  in  which  case  only  the  pipe
  261.      default is changed.  Otherwise, both are changed.  This
  262.      option cannot be reset using the '-' command from within
  263.      Less.
  264.      These default settings are pretty minimal, designed for
  265.      situations where memory is really at a premium.  (A full
  266.      page of text on a high-res screen can be nearly 4k.)  If
  267.      you have enough memory, you may want to use an environment
  268.      variable to revise them upward;  I use -bf15bp100.
  269.  
  270. -c and -C  3-way switch
  271.      If the -c option is set, when _l_e_s_s needs to change the
  272.      entire  display,  it will paint from the top line down.
  273.      Otherwise, it will repaint  the  screen  by  scrolling
  274.      from  the  bottom  of  the screen.
  275.      The -C option is like -c, but  the  screen  is  cleared
  276.      before it is repainted.  This is the fastest option, and
  277.      is the default upon program startup.
  278.      The -c or -C option may be overridden for backward file
  279.      motion by a sufficiently large setting of -h.  If -h is
  280.      set larger than the screen size, full page backwards
  281.      movements will scroll regardless of the -C setting.
  282.  
  283. -e and -E  3-way switch
  284.      Under -e, the only way to exit less is via the "q"  com-
  285.      mand, or the screen close gadget.  Without the -e option,
  286.      less automatically exits if you use a page forward com-
  287.      mand when you have already reached end-of-file (default).
  288.      The -E flag causes less  to  exit if you use any of the
  289.      usual commands (not just page forward) after you have
  290.      reached end-of-file.
  291.      Regardless of the setting of this switch, Less will quit
  292.      immediately upon receipt of a BREAK signal.  BREAK may
  293.      be generated by the AmigaDOS "break" command directed at
  294.      the Less process, or by a ^C in the invoking CLI window
  295.      (if there is one).  A ^C in the Less window is ignored,
  296.      with a warning message.
  297.  
  298. -h   Numeric
  299.      The -h option interacts with -c to specify under what
  300.      conditions backwards scrolling will be used to update a
  301.      display.  The -h setting is the maximum number of lines
  302.      to scroll  backwards.  If  it  is necessary  to move
  303.      backwards more than this many lines, or more than one
  304.      screenful, the screen is repainted in a forward  direction.
  305.      Backwards movements of exactly one screenful are handled
  306.      according to the -c setting, if the user leaves -h unset.
  307.      If -h is left unspecified by the user, it defaults to one
  308.      less than the screen size.  Once the user specifies a
  309.      value, however, that value is retained for the balance of
  310.      the run.  Use -h0 to disable all backwards scrolling.
  311.  
  312. -m and -M  3-way switch
  313.      By default, _l_e_s_s prompts verbosely (-m), with the
  314.      percent into the file. The -M option causes _l_e_s_s to
  315.      prompt even more verbosely than -m.  If neither -m nor
  316.      -M is set, the prompt is very short.  Note that Less
  317.      automatically shortens any prompt if the screen is not
  318.      wide enough.
  319.  
  320. -P   String; command line or environment only
  321.      The -P option provides a way to tailor the three prompt
  322.      styles  to your own preference.  You would normally put
  323.      this option in your LESS environment  variable,  rather
  324.      than type it in with each less command.  Such an option
  325.      must either be the last option in the LESS variable, or
  326.      be  terminated  by  a  dollar  sign.   -P followed by a
  327.      string changes  the  default  (short)  prompt  to  that
  328.      string.   -Pm  changes  the  medium  (-m) prompt to the
  329.      string, and -PM changes  the  long  (-M)  prompt.   The
  330.      string  consists  of  a  sequence  of letters which are
  331.      replaced with certain predefined strings, as follows:
  332.           Ffile name
  333.           ffile name, only once
  334.           Ofile n of n
  335.           ofile n of n, only once
  336.           bbyte offset
  337.           ppercent into file
  338.           Ppercent if known, else byte offset
  339.      Angle brackets, < and >, may  be  used  to  surround  a
  340.      literal  string  to  be  included  in  the prompt.  The
  341.      defaults are "fo" for the short prompt, "foP"  for  the
  342.      medium prompt, and "Fobp" for the long prompt.
  343.      Example: Setting your LESS variable  to  "PmFOP$PMFObp"
  344.      would  change  the  medium  and  long prompts to always
  345.      include the file name and "file n of n" message.
  346.      Another example: Setting your LESS variable to
  347.      "mPm<--Less-->FoPe" would change the medium  prompt  to
  348.      the  string  "--Less--"  followed  by the file name and
  349.      percent into the file.   It  also  selects  the  medium
  350.      prompt  as  the  default  prompt  (because of the first
  351.      "m").
  352.  
  353. -q and -Q  3-way switch
  354.      Normally, if an attempt is made to scroll past the  end
  355.      of  the  file  or before the beginning of the file, the
  356.      screen flashes ("visual bell") to indicate this  fact.
  357.      The  -q option  tells  _l_e_s_s not to flash the screen at
  358.      such times.
  359.      Even if -q is given, _l_e_s_s will flash the screen on certain
  360.      other errors, such as typing an invalid character.  The
  361.      -Q option tells _l_e_s_s to be quiet all the time; that is,
  362.      never  do the visual bell.
  363.  
  364. -s   2-way switch
  365.      The -s option causes  consecutive  blank  lines  to  be
  366.      squeezed into a single blank line.  This is useful when
  367.      viewing _n_r_o_f_f output.
  368.  
  369. -t   2-way switch
  370.      Normally, forward searches start  just  after  the  top
  371.      displayed line (that is, at the second displayed line).
  372.      Thus forward searches include the  currently  displayed
  373.      screen.  The -t option causes forward searches to start
  374.      just after the bottom line displayed, thus skipping the
  375.      currently displayed screen.
  376.  
  377. -u and -U  3-way switch
  378.      If the -u option is given, backspaces  are  treated  as
  379.      printable  characters;  that  is,  they are sent to the
  380.      terminal when they appear in the input.
  381.      If the -U option is given, backspaces  are  printed  as
  382.      the two character sequence "^H".
  383.      If neither -u nor -U is given, backspaces which  appear
  384.      adjacent  to  an  underscore character are treated spe-
  385.      cially: the underlined  text  is  displayed  using  the
  386.      terminal's   hardware  underlining  capability.   Also,
  387.      backspaces which appear between two  identical  charac-
  388.      ters  are  treated  specially:  the  overstruck text is
  389.      printed using the terminal's hardware boldface capabil-
  390.      ity.   Other  backspaces  are  deleted,  along with the
  391.      preceeding character.  This is the default setting.
  392.      The recognition of ANSI escape sequences is also controlled
  393.      by this switch.  The ANSI underlining, boldface, italic,
  394.      and inverse rendering is only done if neither -u nor -U
  395.      is set.
  396.  
  397. -w   2-way switch
  398.      Normally, _l_e_s_s uses  a  tilde  character  to  represent
  399.      lines  past  the end of the file.  The -w option causes
  400.      blank lines to be used instead.
  401.  
  402. -x   Numeric
  403.      The -x_n option sets tab stops every _n  positions.   The
  404.      default for _n is 8.
  405.  
  406. -[z] Numeric
  407.      When given a backwards or forwards window command, _l_e_s_s
  408.      will  by  default  scroll  backwards  or  forwards  one
  409.      screenful of lines. The -z_n option changes the  default
  410.      scrolling window size to _n lines, or one  screenful,
  411.      whichever is smaller.  Note  that the "z" is optional for
  412.      compatibility with _m_o_r_e.  If the screen is resized
  413.      so that the -z option would be larger than a screenful,
  414.      -z is reset to this smaller screen size.  If the screen
  415.      is then enlarged to a size greater than -z, the previously
  416.      specified value is restored.
  417.  
  418. +    String
  419.      If a command line option begins with +,  the  remainder
  420.      of  that  option  is  taken to be an initial command to
  421.      _l_e_s_s.  For example, +G tells _l_e_s_s to start at  the  end
  422.      of  the file rather than the beginning, and +/xyz tells
  423.      it to start at the first  occurence  of  "xyz"  in  the
  424.      file.    As   a   special  case,  +<number>  acts  like
  425.      +<number>g; that is,  it  starts  the  display  at  the
  426.      specified  line  number  (however, see the caveat under
  427.      the "g" command above).  If the option starts with  ++,
  428.      the initial command applies to every file being viewed,
  429.      not just the first one.  The + command described previ-
  430.      ously  may  also  be used to set (or change) an initial
  431.      command for every file.
  432.  
  433. -[N,N,N,N]
  434.      If an option of this form appears on the command line,
  435.      Less uses the information to size and position its display
  436.      window.  Any of the four values may be omitted, defaulting
  437.      to 0.  If one or more of the last values is omitted, the
  438.      trailing commas may be omitted also.  A value of zero in
  439.      either of the last two positions causes Less to use maximum
  440.      screen dimensions.  The four values indicate in order the
  441.      left edge, top edge, width, and height of window to use.
  442.      If any of these are negative, they are taken as relative
  443.      to the bottom right corner of the workbench screen.  Thus,
  444.      -[0,12,,-100] will open a full-width window extending from
  445.      12 pixels from the top to 100 pixels from the bottom of
  446.      the screen. Similarly, -[-400,0,400,0] would open a full-
  447.      height window which is flush against the right edge of the
  448.      screen and 400 pixels wide.  If the window specified would
  449.      fall off an edge of the screen, or would go less than a
  450.      certain minimum size, the window is silently coerced back
  451.      into conformity.
  452.  
  453. _R_e_g_u_l_a_r _E_x_p_r_e_s_s_i_o_n _P_a_t_t_e_r_n _M_a_t_c_h_i_n_g
  454.  
  455. Less uses Regular Expressions, in the style of Unix 'ed', for
  456. specifying searches.  While these expressions can appear quite
  457. cryptic, they are very powerful tools for locating text within
  458. a document.
  459.  
  460. Any pattern consisting only of letters, numbers, and spaces will
  461. simply search for the given pattern.  But you can use one or
  462. more of the metacharacters [].^$()|*+ to engineer very
  463. sophisticated searches.  The '.' stands for any single character,
  464. and 'x*' stands for 0 or more occurances of x (so 'x.*y' would
  465. match anything that started with x and ended with y).  'x+'
  466. works the same way, for 1 or more occurances of x.  'x?' matches
  467. 0 or 1 occurances of x (i.e. 'x' or nothing).  '[abc]' matches
  468. any single occurance of 'a', 'b', or 'c'.  '[^abc]' matches any
  469. single character except 'a', 'b', or 'c'.  '[a-m]' matches any
  470. single character in the range 'a' through 'm' inclusive.  '^x'
  471. finds x only at the beginning of a line; 'x$' only at the end of
  472. a line.  'x|y' matches either x or y.  The various pieces can be
  473. combined, of course, and grouped with parentheses.  For instance,
  474. '([Aa]ny|[Ee]ach) +of you' would find any phrase beginning with
  475. 'any' or 'each' (possibly capitalized) followed by one or more
  476. blanks, followed by 'of you'. ' (can)?not ' matches either 'not'
  477. or 'cannot', but not 'nothing' or 'cancel'.  '[^a-zA-Z]i[^a-zA-Z]'
  478. finds all occurances of a variable 'i' in a program, but does not
  479. find 'i' embedded in other variable names or words.  To match a
  480. metacharacter literally, precede it with a backslash; e.g. '\.  \*'
  481. would match a period followed by two spaces and an asterisk.
  482.  
  483.  
  484. _O_t_h_e_r _C_o_n_s_i_d_e_r_a_t_i_o_n_s
  485.  
  486. Less is residentable, so if you use it a lot you may wish to add
  487. it to your system resident list.  To do this, make sure the pure
  488. bit is set in the file protection codes (protect +p Less).  Then
  489. add the line "resident c:Less" (or whatever your path is) to your
  490. startup-sequence.
  491.  
  492. Less uses internally Ascii characters 0 and 129-136.  Since these
  493. are non-printing characters, it shouldn't make any difference
  494. under normal circumstances.  Character 0 will display as '@' and
  495. 129-136 as ^?.
  496.  
  497.  
  498. _W_h_e_n _u_s_e_d _o_n _s_t_a_n_d_a_r_d _i_n_p_u_t (_r_a_t_h_e_r _t_h_a_n _a  _f_i_l_e),  _y_o_u  _c_a_n
  499. _m_o_v_e  _b_a_c_k_w_a_r_d_s  _o_n_l_y _a _f_i_n_i_t_e _a_m_o_u_n_t, _c_o_r_r_e_s_p_o_n_d_i_n_g _t_o _t_h_a_t
  500. _p_o_r_t_i_o_n _o_f _t_h_e _f_i_l_e _w_h_i_c_h _i_s _s_t_i_l_l _b_u_f_f_e_r_e_d.  _T_h_e -_b  _o_p_t_i_o_n
  501. _m_a_y _b_e _u_s_e_d _t_o _e_x_p_a_n_d _t_h_e _b_u_f_f_e_r _s_p_a_c_e.
  502.  
  503.